<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/23
 * Time: 16:51
 */
namespace app\lib\exception;

use think\Exception;

class BaseException extends Exception{

//    HTTP状态码
    public $code = 400;
//    错误信息
    public $msg = '参数错误';
//    自定义错误码
    public $errorCode = '10000';

    public function __construct($param = []){
//        print_r($param);die;
        if(!is_array($param)){
            throw new Exception('参数必须是数组');
        }
        if(array_key_exists('code',$param)){
            $this->code = $param['code'];
        }
        if(array_key_exists('msg',$param)){
            $this->msg = $param['msg'];
        }
        if(array_key_exists('errorCode',$param)){
            $this->errorCode = $param['errorCode'];
        }
    }

}














